commonlibsse_ng\re\b/
bhkRefObject.rs

1//! # bhkRefObject
2//!
3//! This module defines the `bhkRefObject` struct, which inherits from `NiObject` and represents
4//! a reference object in the Havok physics system. It includes methods to manage reference counts
5//! and holds a reference to another `hkReferencedObject`.
6
7use crate::re::NiObject::{NiObject, NiObjectVtbl};
8use crate::re::bhkSerializable::bhkSerializable;
9use crate::re::hkRefPtr::hkRefPtr;
10use crate::re::hkReferencedObject::hkReferencedObject;
11use crate::re::offsets_ni_rtti::NiRTTI_bhkRefObject;
12use crate::re::offsets_rtti::RTTI_bhkRefObject;
13use crate::re::offsets_vtable::VTABLE_bhkRefObject;
14use crate::rel::id::VariantID;
15
16#[repr(C)]
17#[derive(Debug)]
18pub struct bhkRefObject {
19    /// Base class `NiObject`.
20    pub __base: NiObject,
21
22    /// Reference to the referenced object.
23    /// - Offset: `0x10`
24    pub referenced_object: hkRefPtr<hkReferencedObject>,
25}
26
27const _: () = {
28    assert!(core::mem::offset_of!(bhkRefObject, __base) == 0x0);
29    assert!(core::mem::offset_of!(bhkRefObject, referenced_object) == 0x10);
30    assert!(core::mem::size_of::<bhkRefObject>() == 0x18);
31};
32
33impl bhkRefObject {
34    /// Address & Offset of the runtime type information (RTTI) identifier.
35    pub const RTTI: VariantID = RTTI_bhkRefObject;
36    /// Address & Offset of the runtime type information (Ni RTTI) identifier.
37    pub const NI_RTTI: VariantID = NiRTTI_bhkRefObject;
38
39    /// Address & Offset of the virtual function table.
40    pub const VTABLE: [VariantID; 1] = VTABLE_bhkRefObject;
41}
42
43/// The virtual function table for `bhkRefObject`.
44/// This struct defines function pointers to simulate the C++ virtual functions.
45#[repr(C)]
46pub struct bhkRefObjectVtbl {
47    pub __base: NiObjectVtbl,
48
49    /// Function pointer for setting the referenced object.
50    pub SetReferencedObject: fn(this: &mut bhkSerializable, a_object: *mut hkReferencedObject),
51    /// Function pointer for adjusting the reference count.
52    pub AdjustRefCount: fn(this: &mut bhkRefObject, a_increment: bool),
53}